home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 101-125 / scopedisk108 / dedit / stringlib.doc < prev    next >
Text File  |  1995-03-19  |  6KB  |  204 lines

  1. This file documents the usage of the functions in string.library
  2.  
  3.  
  4.  
  5. *********************************************************************
  6. LtoX
  7.  
  8.    Convert a long to a null terminated string of 8 hex characters.
  9.  
  10.    Template
  11.       LtoX(num, string)
  12.            d0     a0
  13.       inputs:
  14.          long num;      /* long to be converted        */
  15.          char *string;  /* pointer to an array of char */
  16.  
  17.  
  18. *********************************************************************
  19. XtoL
  20.  
  21.    Convert a hex string to a long
  22.  
  23.    Template
  24.       num = XtoL(hex);
  25.       d0         a0
  26.       input:
  27.          char *hex;  /* pointer to hexstring */
  28.       return:
  29.          long num;   /* result */
  30.  
  31.  
  32.  
  33. *********************************************************************
  34. StrReq
  35.  
  36.    Put a requester up on a screen and return length of entered string
  37.  
  38.    Template
  39.       length = StrReq(strreq);
  40.         d0              a0
  41.       input:
  42.          struct StrRequester *strreq;  /* pointer to StrRequester struct */
  43.       return:
  44.          long length;                  /* length of entered string */
  45.  
  46.    The StrRequester structure is set up like this...
  47.    struct StrRequester
  48.    {
  49.       SHORT  sr_LeftEdge;    /* Top Left corner  */
  50.       SHORT  sr_TopEdge;     /* of the requester */
  51.       long   sr_MaxOutWidth; /* Maximum length of string that will be accepted */
  52.       char   *sr_Prompt;     /* Prompt that will be displayed in the requester */
  53.       char   *sr_OutBuff;    /* Buffer for entered string */
  54.       struct Screen *sr_Screen; /* screen to put requester on or NULL for WB screen */
  55.    };
  56.  
  57.  
  58. *********************************************************************
  59. Center
  60.  
  61.    Center a string in a specified width with a pad character
  62.  
  63.    Template
  64.       Center(source, dest, width, pad);
  65.                a0     a1    d0    d1
  66.       inputs:
  67.          char *source; /* string to center */
  68.          char *dest;   /* centered string. must be at least width+1 long */
  69.          int  width;   /* width to center string in */
  70.          char pad;     /* character to pad the string with */
  71.  
  72.  
  73. *********************************************************************
  74. CtoP
  75.  
  76.    Check if a character is printable, if not change it to '·' (ALT+8)
  77.  
  78.    Template
  79.       char = CtoP((int)char);
  80.                      a0
  81.       input:
  82.          char char;
  83.       return:
  84.          char char;
  85.  
  86.  
  87. *********************************************************************
  88. BtoCStr
  89.  
  90.    Convert a BPTR to a null terminated C string.
  91.  
  92.    Template
  93.       length = BtoCStr(source, dest, maxlen);
  94.         d0               a0     a1     d0
  95.       inputs:
  96.          BPTR source;  /* BPTR to a BSTR */
  97.          char *dest;   /* C string */
  98.          int maxlen;   /* maximum length of C string */
  99.       return:
  100.          long length;  /* length of C string */
  101.  
  102.  
  103. *********************************************************************
  104. MidStr
  105.  
  106.    Return a part of source string from start for length characters.
  107.  
  108.    Template
  109.       length = MidStr(source, dest, start, length);
  110.         d0              a0     a1     d0     d1
  111.       inputs:
  112.          char *source;  /* string to cut up */
  113.          char *dest;    /* requested piece of source (null terminated) */
  114.          int start;     /* starting character */
  115.          int length;    /* number of characters to copy */
  116.       return:
  117.          long length;   /* length of output string */
  118.  
  119.  
  120. *********************************************************************
  121. LeftStr
  122.  
  123.    Return the leftmost length characters of source string.
  124.  
  125.    Template
  126.       length = LeftStr(source, dest, len);
  127.         d0               a0     a1   d0
  128.       inputs:
  129.          char *source;  /* string to cut up */
  130.          char *dest;    /* leftmost piece of source (null terminated) */
  131.          int len;       /* number of characters to copy */
  132.       return:
  133.          long length;   /* length of output string */
  134.  
  135.  
  136. *********************************************************************
  137. RightStr
  138.  
  139.    Return the rightmost length characters of source string.
  140.  
  141.    Template
  142.       length = RightStr(source, dest, len);
  143.         d0                a0     a1   d0
  144.       inputs:
  145.          char *source;  /* string to cut up */
  146.          char *dest;    /* rightmost piece of source (null terminated) */
  147.          int len;       /* number of characters to copy */
  148.       return:
  149.          long length;   /* length of output string */
  150.  
  151.  
  152. *********************************************************************
  153. InsertStr
  154.  
  155.    Insert ins string into source string.
  156.  
  157.    Template
  158.       length = LeftStr(source, dest, ins, start);
  159.         d0               a0     a1   d0    d1
  160.       inputs:
  161.          char *source;  /* string to cut up */
  162.          char *dest;    /* result string (null terminated) */
  163.          char *ins;     /* string to insert */
  164.          int start;     /* position to insert the string */
  165.       return:
  166.          long length;   /* length of output string */
  167.  
  168.  
  169. *********************************************************************
  170. DelStr
  171.  
  172.    Cut a piece out of the middle of the source string.
  173.  
  174.    Template
  175.       length = DelStr(source, dest, start, len);
  176.         d0               a0     a1   d0    d1
  177.       inputs:
  178.          char *source;  /* string to cut up */
  179.          char *dest;    /* result string (null terminated) */
  180.          int start;     /* where to start cutting */
  181.          int len;       /* number of characters to copy */
  182.       return:
  183.          long length;   /* length of output string */
  184.  
  185. *********************************************************************
  186.  
  187.  
  188.      This library was written entirely in assembly using the C.A.P.E
  189. assembler.  I have tried to keep it as compact as possible.
  190.  
  191.      I have only programed this library using the Lattice 5.0 C compiler.
  192. I have included the include file stringlib.h which defines function
  193. prototypes and pragmas so there is no need for a linker library.  Simply
  194. include strinlib.h, OpenLibrary() string.library, and call whatever
  195. function you need.
  196.  
  197.  
  198. ---------------------------------------------------------------------- 
  199.  
  200. Send questions or comments to...  
  201.  
  202. Mike Ruble      CompuServe ID: 71310,1237 
  203.  
  204.